Skip to content

Fix: correct column index assertion in Matrix_Corner_Block and Matrix_Periodic_Banded #566#567

Merged
EmilyBourne merged 2 commits into
gyselax:develfrom
Quntized:fix/matrix-corner-and-periodic-banded-asserion
Mar 4, 2026
Merged

Fix: correct column index assertion in Matrix_Corner_Block and Matrix_Periodic_Banded #566#567
EmilyBourne merged 2 commits into
gyselax:develfrom
Quntized:fix/matrix-corner-and-periodic-banded-asserion

Conversation

@Quntized

@Quntized Quntized commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Fix: correct column index assertion in Matrix_Corner_Block and Matrix_Periodic_Banded #566

In src/matrix_tools/matrix_corner_block.cpp and src/matrix_tools/matrix_periodic_banded.cpp both get_element and set_element contain same assert twice assert(i < n); and not the check for j any. This maybe copy-paste typo accidentally.

double Matrix_Corner_Block::get_element(int const i, int const j) const
{
    assert(i >= 0);
    assert(i < n);
    assert(j >= 0);
    assert(i < n);   //This should be checked for j;
   ....
}

and

void Matrix_Corner_Block::set_element(int const i, int const j, double const a_ij)
{
   assert(i >= 0);
   assert(i < n);
   assert(j >= 0);
   assert(i < n);    //Same for this one;
  .....
}

double Matrix_Periodic_Banded::get_element(int const i, int j) const
{
    assert(i >= 0);
    assert(i < n);
    assert(j >= 0);
    assert(i < n);   //Same for this one;
   .....
}
void Matrix_Periodic_Banded::set_element(int const i, int j, double const a_ij)
{
    assert(i >= 0);
    assert(i < n);
    assert(j >= 0);
    assert(i < n); //Same for this one;
   .......
}


Please complete the checklist to ensure that all tasks are completed before marking your pull request as ready for review.

All Submissions

  • Have you ensured that all lines changed in this PR are justified by a comment found in the description ?
  • Have you updated the CHANGELOG.md ?
  • Have you linked any issues that should be closed when this PR is merged (using closing keywords) ?
  • Have you checked that the AUTHORS file is up to date ?
  • Have you checked that the copyright information in the LICENCE file is up to date (including dates) ?
  • Do you follow the conventions specified in our coding standards ?

New Feature Submissions

  • Have you added tests for the new functionalities ?
  • Have you documented the new functionalities:
    • API documentation describing the available methods, when each should be used and how to use them ?
    • User-friendly documentation in README files (which may link to the API documentation).
    • If the new functionality is non-trivial to use, provide a tutorial or example ? (optional)

Changes to Existing Features

  • Have you checked that existing tests cover all code after the changes ?
  • Have you checked that existing tests are still passing ?
  • Have you checked that the existing documentation is still accurate (API and README files) ?

Changes to the CI

  • Have you made the same changes to both the GitHub CI and the GitLab CI (for the private fork) ?

@Quntized Quntized changed the title Fix: correct column index assertion in Matrix_Corner_Block and Matrix… Fix: correct column index assertion in Matrix_Corner_Block and Matrix_Periodic_Banded #566 Mar 3, 2026
@EmilyBourne

Copy link
Copy Markdown
Member

@Quntized Thanks again for this bug fix. Well done for catching all these corner cases!

@Quntized Quntized had a problem deploying to GitLab GPU trigger March 4, 2026 07:48 — with GitHub Actions Failure
@Quntized

Quntized commented Mar 4, 2026

Copy link
Copy Markdown
Contributor Author

@Quntized Thanks again for this bug fix. Well done for catching all these corner cases!

Thank you, I'm really enjoying the project.
Happy to help — looking forward to contributing more!

@codecov

codecov Bot commented Mar 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/matrix_tools/matrix_periodic_banded.cpp 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EmilyBourne EmilyBourne merged commit 047d890 into gyselax:devel Mar 4, 2026
24 of 27 checks passed
EmilyBourne pushed a commit that referenced this pull request Mar 5, 2026
…_Periodic_Banded #566 (#567)

Fix: correct column index assertion in Matrix_Corner_Block and
Matrix_Periodic_Banded #566

In ```src/matrix_tools/matrix_corner_block.cpp``` and ```
src/matrix_tools/matrix_periodic_banded.cpp``` both get_element and
set_element contain same assert twice assert(i < n); and not the check
for j any. This maybe copy-paste typo accidentally.

```
double Matrix_Corner_Block::get_element(int const i, int const j) const
{
    assert(i >= 0);
    assert(i < n);
    assert(j >= 0);
    assert(i < n);   //This should be checked for j;
   ....
}
```
and 

 ```
void Matrix_Corner_Block::set_element(int const i, int const j, double
const a_ij)
{
    assert(i >= 0);
    assert(i < n);
    assert(j >= 0);
    assert(i < n);    //Same for this one;
   .....
}

```
```
double Matrix_Periodic_Banded::get_element(int const i, int j) const
{
    assert(i >= 0);
    assert(i < n);
    assert(j >= 0);
    assert(i < n);   //Same for this one;
   .....
}
```

```
void Matrix_Periodic_Banded::set_element(int const i, int j, double
const a_ij)
{
    assert(i >= 0);
    assert(i < n);
    assert(j >= 0);
    assert(i < n); //Same for this one;
   .......
}

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants